import loadable from "@loadable/component"
import { RouteProps } from "react-router-dom"

interface MRoutesProps extends RouteProps {
  key: string
  title: string
}

const HomeComponent = loadable(() => import("@/pages/home"))
const DetailComponent = loadable(() => import("@/pages/detail"))
const CreateListComponent = loadable(() => import("@/pages/list"))
const PageManageComponent = loadable(() => import("@/pages/page-manage"))

export const route: MRoutesProps[] = [
  {
    key: "home",
    title: "主页",
    path: "/home",
    component: HomeComponent,
  },
  {
    key: "detail",
    title: "详细",
    path: "/detail/:uuid",
    component: DetailComponent,
  },
  {
    key: "create",
    title: "新建评分",
    path: "/create",
    component: CreateListComponent,
  },
  {
    key: "page_manage",
    title: "管理页面",
    path: "/page_manage",
    component: PageManageComponent,
  },
]

interface MenuList {
  key: string
  title: string
  path: string
}

export interface MMenuItem {
  key: string
  title: string
  path: string
  children?: MenuList[]
}

export const menus: MMenuItem[] = [
  {
    key: "home",
    title: "主页",
    path: "/home",
  },
  // {
  //   key: "home2",
  //   title: "主页2",
  //   path: "",
  //   children: [
  //     {
  //       title: "sub index2",
  //       path: "/home",
  //       key: "subindex2",
  //     },
  //   ],
  // },
  {
    key: "create",
    title: "新建评分",
    path: "/create",
  },
  {
    key: "detail",
    title: "详细评分",
    path: "/detail/f508be0a-71ca-43d4-96b0-d833ba8a85f8",
  },
  {
    key: "page_manage",
    title: "日志整体数据",
    path: "/page_manage",
  },
]
